﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>常用工艺术语定义</title>
    <link rel="stylesheet" href="~/Content/bootstrap.min.css" />
    <link rel="stylesheet" href="~/Content/bootstrap-table.css" />
    <link rel="stylesheet" href="~/Content/style.css" />
    <style>
        h2 {
            line-height: normal;
            margin-top: 0px;
        }

        #text {
            border-left: 1px solid #ccc !important;
        }
    </style>
</head>
<body>
    @Html.Action("Top", "Home")
    <div class="top_search">
        <h2>产品报价查询</h2>
        <form class="form1">
            <input id="text" type="text" placeholder="输入产品名称、规格或者拼音助记符">
            <input class="jb" id="btn" type="submit" value="查询">
        </form>
    </div>

    <div class="clear"></div>

    <div class="table1">
        <table data-show-export="true"></table>
    </div>

    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script src="~/Scripts/bootstrap-table.js"></script>
    <script src="~/Scripts/locale/bootstrap-table-zh-CN.js"></script>
    <script src="~/Scripts/uilts.js"></script>
    <script src="~/Scripts/extensions/export/bootstrap-table-export.js"></script>
    <script>
        var $table = $('table');
        function InitTable(pageIndex, pageSize) {
            if (typeof pageIndex == "object") {
                pageIndex = undefined;
            }
            $table.bootstrapTable('destroy');
            $table.bootstrapTable({
                method: "post",  //使用get请求到服务器获取数据
                url: "/Product/listdata", //获取数据的Servlet地址
                striped: true,  //表格显示条纹
                pagination: true, //启动分页
                pageSize: pageSize == null ? 10 : pageSize,  //每页显示的记录数
                pageNumber: pageIndex == null ? 1 : pageIndex, //当前第几页
                pageList: [10, 20, 50, 100, 250],  //记录数可选列表
                search: false,  //是否启用查询
                showColumns: true,  //显示下拉框勾选要显示的列
                showRefresh: true,  //显示刷新按钮
                sidePagination: "server", //表示服务端请求
                sortName: "ID",
                //设置为undefined可以获取pageNumber，pageSize，searchText，sortName，sortOrder
                //设置为limit可以获取limit, offset, search, sort, order
                queryParamsType: "undefined",
                queryParams: function queryParams(params) {   //设置查询参数
                    var param = {
                        PageIndex: params.pageNumber,
                        PageSize: params.pageSize,
                        search: $("#text").val().trim(),
                        sorter: params.sortName + " " + params.sortOrder
                    };
                    return param;
                },
                columns: [
                    {
                        field: 'Sno',
                        title: "产品编号",
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        field: 'Name',
                        title: '产品名称',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        field: 'price',
                        title: '产品价格',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        field: 'material_price',
                        title: '材料价格',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        field: 'ProcessingFees',
                        title: '加工费',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        field: 'Profit',
                        title: '利润率',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        field: 'Weight',
                        title: '产品净重(kg)',
                        align: 'center',
                        valign: 'middle'
                    }
                ],
                onLoadSuccess: function () {
                    $('table tr:even').find('td').css("background", "#e9f3ff");
                    $('table tr').click(function () {
                        uncheckAll($table);
                        $('table tr').removeClass("act");
                        $(this).addClass("act");
                        $table.bootstrapTable('check', $(this).attr("data-index"));
                    });
                }
            });
        }

        InitTable();

    </script>
    <script src="~/Scripts/tableExport.js"></script>
    <script src="~/Scripts/html2canvas.js"></script>
    <script src="~/Scripts/jquery.base64.js"></script>
    <script src="~/Scripts/menu.js"></script>
</body>
</html>
